function Notification(options) {
	const defaultOptions = {
		type: 'info',
		message: '',
		duration: 3000,
		right: 20,
		top: 20,
		gap: 20
	};
	this.options = { ...defaultOptions, ...options };
	this.init();
}
Notification.prototype.init = function() {
	const { type, message, duration, right, top, gap } = this.options;
	const notifications = document.querySelectorAll('.notification');
	const lastNotification = notifications[notifications.length - 1];
	const notificationElement = document.createElement('div');
	notificationElement.className = `notification notification-${type}`;
	notificationElement.innerHTML = message;
	notificationElement.style.right = `${right}px`;
	// 根据最后一个通知元素进行top定位
	if (!lastNotification) {
		notificationElement.style.top = `${top}px`;
	} else {
		notificationElement.style.top = `${parseInt(lastNotification.style.top) + lastNotification.offsetHeight + gap}px`;
	}
	document.body.appendChild(notificationElement);
	// 显示通知
	setTimeout(() => {
		notificationElement.classList.add('show');
	}, 10);
	// 自动关闭
	setTimeout(() => {
		this.closeNotification(notificationElement);
	}, duration);
};
Notification.prototype.closeNotification = function(notificationElement) {
	notificationElement.classList.add('hide');
	notificationElement.addEventListener('transitionend', () => {
		notificationElement.remove();
		this.moveUpNotifications();
	});
};
Notification.prototype.moveUpNotifications = function() {
	const { top, gap } = this.options;
	const notifications = document.querySelectorAll('.notification');
	let topOffset = top; // Starting offset from the top
	notifications.forEach((notification) => {
		notification.style.top = `${topOffset}px`;
		topOffset += notification.offsetHeight + gap;
	});
};
/**
 * 提示
 */
export function notify(options = {}) {
	new Notification({ type: 'success', duration: 2000, ...options });
}